#include <deque>
#include <stdio.h>
using namespace std;

int t;
int n, k;
char game[52][52];
int vis[52][52][4];
int fi;
char win;

deque< pair<int, int> > queue;


int main() {
	scanf("%d", &t);

	for (int grr=1; grr<=t; grr++) {
		queue.clear();

		scanf("%d %d", &n, &k);

		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				scanf(" %c", &game[j][n-1-i]);
			}
		}

		for (int i=0; i<=n; i++) {
			vis[i][0][0]=0;
			vis[i][0][1]=0;
			vis[i][0][2]=0;
			vis[i][0][3]=0;

			vis[0][i][0]=0;	
			vis[0][i][1]=0;
			vis[0][i][2]=0;
			vis[0][i][3]=0;
		}

		for (int j=0; j<n; j++) {
			fi=-1;
			
			for (int i=n-1; i>=0; i--) {
		
				if (game[i][j]=='.' && fi==-1) {
					fi=i; 
				} else {
					if (fi>i && game[i][j]!='.') {
						game[fi][j]=game[i][j];
						fi--;
						game[i][j]='.';
					}
				}
			}
		}

		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				if (game[i][j]=='R') {
					vis[i+1][j+1][0]=vis[i][j][0]+1;
					vis[i+1][j+1][1]=vis[i][j+1][1]+1;
					vis[i+1][j+1][2]=vis[i][j+2][2]+1;
					vis[i+1][j+1][3]=vis[i+1][j][3]+1;
				} else {
					vis[i+1][j+1][0]=0;
					vis[i+1][j+1][1]=0;
					vis[i+1][j+1][2]=0;
					vis[i+1][j+1][3]=0;
				}
			}
		}

		int greatRed=0;

		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				if (vis[i+1][j+1][0] > greatRed)
					greatRed = vis[i+1][j+1][0];
				if (vis[i+1][j+1][1] > greatRed)
					greatRed = vis[i+1][j+1][1];
				if (vis[i+1][j+1][2] > greatRed)
					greatRed = vis[i+1][j+1][2];
				if (vis[i+1][j+1][3] > greatRed)
					greatRed = vis[i+1][j+1][3];
			}
		}
		
		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				if (game[i][j]=='B') {
					vis[i+1][j+1][0]=vis[i][j][0]+1;
					vis[i+1][j+1][1]=vis[i][j+1][1]+1;
					vis[i+1][j+1][2]=vis[i][j+2][2]+1;
					vis[i+1][j+1][3]=vis[i+1][j][3]+1;
				} else {
					vis[i+1][j+1][0]=0;
					vis[i+1][j+1][1]=0;
					vis[i+1][j+1][2]=0;
					vis[i+1][j+1][3]=0;
				}
			}
		}

		int greatBlue=0;

		for (int i=0; i<n; i++) {
			for (int j=0; j<n; j++) {
				if (vis[i+1][j+1][0] > greatBlue)
					greatBlue = vis[i+1][j+1][0];
				if (vis[i+1][j+1][1] > greatBlue)
					greatBlue = vis[i+1][j+1][1];
				if (vis[i+1][j+1][2] > greatBlue)
					greatBlue = vis[i+1][j+1][2];
				if (vis[i+1][j+1][3] > greatBlue)
					greatBlue = vis[i+1][j+1][3];
			}
		}

		printf("Case #%d: ", grr);

		if (greatRed<k) {
			if (greatBlue<k)
				printf("Neither\n");
			else
				printf("Blue\n");
		} else {
			if (greatBlue<k)
				printf("Red\n");
			else
				printf("Both\n");
		} 
	}

	return 0;
}
